/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Winner
 */
@Entity
@Table(name = "tblUser")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblUser.findAll", query = "SELECT t FROM TblUser t"),
    @NamedQuery(name = "TblUser.findByUsID", query = "SELECT t FROM TblUser t WHERE t.usID = :usID"),
    @NamedQuery(name = "TblUser.findByUsName", query = "SELECT t FROM TblUser t WHERE t.usName = :usName"),
    @NamedQuery(name = "TblUser.findByUsUserName", query = "SELECT t FROM TblUser t WHERE t.usUserName = :usUserName"),
    @NamedQuery(name = "TblUser.findByUsPassword", query = "SELECT t FROM TblUser t WHERE t.usPassword = :usPassword"),
    @NamedQuery(name = "TblUser.findByUsEmail", query = "SELECT t FROM TblUser t WHERE t.usEmail = :usEmail"),
    @NamedQuery(name = "TblUser.findByUsPhone", query = "SELECT t FROM TblUser t WHERE t.usPhone = :usPhone"),
    @NamedQuery(name = "TblUser.findByUsAdress", query = "SELECT t FROM TblUser t WHERE t.usAdress = :usAdress"),
    @NamedQuery(name = "TblUser.findByUsCompany", query = "SELECT t FROM TblUser t WHERE t.usCompany = :usCompany"),
    @NamedQuery(name = "TblUser.findByUsStatus", query = "SELECT t FROM TblUser t WHERE t.usStatus = :usStatus"),
    @NamedQuery(name = "TblUser.checkLogin", query = "SELECT t FROM TblUser t WHERE t.usUserName = :usUserName AND t.usPassword = :usPassword")}) 


public class TblUser implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "usID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer usID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 150)
    @Column(name = "usName")
    private String usName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "usUserName")
    private String usUserName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "usPassword")
    private String usPassword;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "usEmail")
    private String usEmail;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "usPhone")
    private String usPhone;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "usAdress")
    private String usAdress;
    @Size(max = 100)
    @Column(name = "usCompany")
    private String usCompany;
    @Column(name = "usStatus")
    private Boolean usStatus;
    @OneToMany(mappedBy = "usID")
    private List<TblComplaint> tblComplaintList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "usID")
    private List<TblOrder> tblOrderList;
    @OneToMany(mappedBy = "usID")
    private List<TblFeedback> tblFeedbackList;

    public TblUser() {
    }

    public TblUser(Integer usID) {
        this.usID = usID;
    }

    public TblUser(Integer usID, String usName, String usUserName, String usPassword, String usEmail, String usPhone, String usAdress) {
        this.usID = usID;
        this.usName = usName;
        this.usUserName = usUserName;
        this.usPassword = usPassword;
        this.usEmail = usEmail;
        this.usPhone = usPhone;
        this.usAdress = usAdress;
    }

    public TblUser(Integer usID, String usName, String usUserName, String usPassword, String usEmail, String usPhone, String usAdress, boolean usStatus) {
        this.usID = usID;
        this.usName = usName;
        this.usUserName = usUserName;
        this.usPassword = usPassword;
        this.usEmail = usEmail;
        this.usPhone = usPhone;
        this.usAdress = usAdress;
        this.usStatus = usStatus;
    }

    public Integer getUsID() {
        return usID;
    }

    public void setUsID(Integer usID) {
        this.usID = usID;
    }

    public String getUsName() {
        return usName;
    }

    public void setUsName(String usName) {
        this.usName = usName;
    }

    public String getUsUserName() {
        return usUserName;
    }

    public void setUsUserName(String usUserName) {
        this.usUserName = usUserName;
    }

    public String getUsPassword() {
        return usPassword;
    }

    public void setUsPassword(String usPassword) {
        this.usPassword = usPassword;
    }

    public String getUsEmail() {
        return usEmail;
    }

    public void setUsEmail(String usEmail) {
        this.usEmail = usEmail;
    }

    public String getUsPhone() {
        return usPhone;
    }

    public void setUsPhone(String usPhone) {
        this.usPhone = usPhone;
    }

    public String getUsAdress() {
        return usAdress;
    }

    public void setUsAdress(String usAdress) {
        this.usAdress = usAdress;
    }

    public String getUsCompany() {
        return usCompany;
    }

    public void setUsCompany(String usCompany) {
        this.usCompany = usCompany;
    }

    public Boolean getUsStatus() {
        return usStatus;
    }

    public void setUsStatus(Boolean usStatus) {
        this.usStatus = usStatus;
    }

    @XmlTransient
    public List<TblComplaint> getTblComplaintList() {
        return tblComplaintList;
    }

    public void setTblComplaintList(List<TblComplaint> tblComplaintList) {
        this.tblComplaintList = tblComplaintList;
    }

    @XmlTransient
    public List<TblOrder> getTblOrderList() {
        return tblOrderList;
    }

    public void setTblOrderList(List<TblOrder> tblOrderList) {
        this.tblOrderList = tblOrderList;
    }

    @XmlTransient
    public List<TblFeedback> getTblFeedbackList() {
        return tblFeedbackList;
    }

    public void setTblFeedbackList(List<TblFeedback> tblFeedbackList) {
        this.tblFeedbackList = tblFeedbackList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (usID != null ? usID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblUser)) {
            return false;
        }
        TblUser other = (TblUser) object;
        if ((this.usID == null && other.usID != null) || (this.usID != null && !this.usID.equals(other.usID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.aptech.entities.TblUser[ usID=" + usID + " ]";
    }
}
